package com.jilin.library.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class PasswordGenerator {
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(10);
        String password = "admin123";
        String encodedPassword = encoder.encode(password);
        System.out.println("Encoded password: " + encodedPassword);
        
        // 验证密码是否正确
        boolean matches = encoder.matches(password, encodedPassword);
        System.out.println("Password matches: " + matches);
        
        // 打印密码长度，确保格式正确
        System.out.println("Password length: " + encodedPassword.length());
        System.out.println("Password starts with $2a$: " + encodedPassword.startsWith("$2a$"));
    }
} 